/*
 * @Author: ZhangXiaodong
 * @Date: 2025-04-20 01:45:17
 * @LastEditors: ZhangXiaodong
 * @LastEditTime: 2025-04-26 00:25:29
 * @Description: mysql 数据库配置，策略模式区分开发生产
 * @FilePath: /blog-ost/src/config/mysql/db.config.js
 */
const dbConfig = {
  dev: {
    host: process.env.DEV_DB_HOST || 'localhost',
    user: process.env.DEV_DB_USER || 'root',
    password: process.env.DEV_DB_PASSWORD || '449422301',
    port: process.env.DEV_DB_PORT || '3306',
    database: process.env.DEV_DB_NAME || 'myblog',
  },
  production: {
    host: process.env.PROD_DB_HOST || 'localhost',
    user: process.env.PROD_DB_USER || 'root',
    password: process.env.PROD_DB_PASSWORD || '449422301',
    port: process.env.PROD_DB_PORT || '3306',
    database: process.env.PROD_DB_NAME || 'myblog',
  },
};

// 打印环境变量，方便调试
if (process.env.NODE_ENV === 'dev') {
  console.log(process.env.NODE_ENV, 'process.env.NODE_ENV');
}

module.exports = dbConfig[process.env.NODE_ENV];